package com.bruce.service.impl;

import com.bruce.Common.Result;
import com.bruce.Common.Resultcode;
import com.bruce.bean.Major;
import com.bruce.dao.MajorDao;
import com.bruce.dao.impl.MajorDaoImpl;
import com.bruce.service.MajorService;

import java.util.List;

public class MajorServiceImpl implements MajorService {

    MajorDao majorDao=new MajorDaoImpl();

    @Override
    public List<Major> findMajorsByCollegeId(int collegeId) {
        return majorDao.findMajorsByCollegeId(collegeId);
    }

    @Override
    public Result addcourse(int grade, String cid, String sid) {

        int addcourse = majorDao.addcourse(grade, cid, sid);
        if (addcourse<1){
            throw new RuntimeException(Resultcode.Add_Error.getMess());
        }
        return Result.succ();

    }
}
